<?php
	require_once(realpath(dirname(__FILE__)) . "/../pre.php");
	require_once(realpath(dirname(__FILE__)) . "/../auth.php");

require_once(realpath(dirname(__FILE__)) . "/../../fonctions/divers.php");
?>
<?php if(! est_autorise("acces_catalogue")) exit; ?>
<?php
	require_once("../../classes/Contenu.class.php");
	require_once("../../classes/Contenudesc.class.php");
	require_once("../../classes/Dossier.class.php");
	require_once("../../classes/Dossierdesc.class.php");
	header('Content-Type: text/html; charset=utf-8');

	$sep = explode( "_", $_POST['id']);

	$pos = strpos($_POST['id'], "_");
	
	$modif = substr($_POST['id'], 0, $pos);


	if($modif == "titredos"){
		$obj = new Dossier();
		$obj->charger(substr($_POST['id'], $pos+1));	
		$objdesc = new Dossierdesc();
		$objdesc->charger($obj->id, $_SESSION["util"]->lang);
	} else {	
		$obj = new Contenu();
		$obj->charger(substr($_POST['id'], $pos+1));
		$objdesc = new Contenudesc();
		$objdesc->charger($obj->id, $_SESSION["util"]->lang);		
	}	


		
	switch($modif){
		case 'titrecont' :  $objdesc->titre = $_POST['value']; echo $objdesc->titre; break;
		case 'titredos' :  $objdesc->titre = $_POST['value']; echo $objdesc->titre; break;
		case 'ligne' : 
			if($obj->ligne) $obj->ligne = 0;
			else $obj->ligne= 1;
			break;
	}

	$obj->maj();
	$objdesc->maj();
	
	if($modif == "titrecont")
		ActionsModules::instance()->appel_module("moddcont", $obj);
	else
		if($modif == "titredos")
			ActionsModules::instance()->appel_module("moddos", $obj);	
?>